Introduction:
This R Markdown Document will analysis spatiotemeral data from an AFL Game as part of my assessment 3 for SES7005. Further information and documents for reproducibility can be found at:
https://github.com/JarrodRutley/SES7005_Assessment_3
# The following packages will be used throughout the analysis process.
library(tidyverse)
library(plotly)
library(viridis)
# Import Data set 2. Which will be the focus of this assessment
RawData <- read.csv("Assessment3_SpatiotemporalDataset2.csv")
# Remove all the NA's form data set. This will allows us to focus on the performance indicators also makes things a bit easier to work with
MatchData <- na.omit(RawData)
# Do a quick summary of the event data which will be used for our first plot
SummaryStats <- MatchData %>%
select(Game, Action, Location, Quarter)
Total Performance Indicators by Game: This bar chart shows the total action events colored by location and wrapped by game. This shows us that this particular athlete accumulates a lot of their possessions across the midfield. It also shows that their role may have changed over the five games (More defensive in Game 1, more attacking in Game 5).
# First off, lets get see how this athlete has performed, based on the total of their performance indicators, across a 5 games
Plot1 <- ggplot(data = SummaryStats) +
geom_bar(aes(x = Quarter, fill = Location)) +
theme_classic() +
theme(legend.title = element_blank()) +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank()) +
theme(legend.position = "bottom") +
labs(y = "Total") +
facet_wrap(~ Game)
ggplotly(Plot1)
Total Performance Indicators by Quarter: The chart below shows the total action events colored by total and plotted by Quarter. It shows that most the action events are occurring in the midfield (As stated above) and that not lot of action events are occurring in the forward part of the ground, this could be because the athlete is playing the role of a defensive winger who plays a defensive role outside the forward line and sets ups in preparation for a opposition rebound.
# Here we can see the action areas for the athlete. This plot shows which the athlete accumulated most of their possession based on field location.
Plot2 <- MatchData %>%
count(Location, Quarter) %>%
ggplot(aes(x = Quarter, y = Location)) +
theme_classic() +
theme(axis.title.y = element_blank()) +
geom_tile(aes(fill = n))
ggplotly(Plot2)
Specific Action Data
The two plots below show data points for specific action data (Plot 1 = Handball Data, Plot 2 = Kicking Data).
By plotting these two filtered data sets we can analysis what kind of possessions the athlete has and where they are occurring. We can see that they have a high handball ineffective/clanger count in the attacking midfield and that they are more likely to kick short in particular in the defensive half of the ground.
HANDBALL DATA
#Handball Data
HandballData <- MatchData %>%
filter(Action == "Handball Effective" | Action == "Handball Ineffective" | Action == "Handball Clanger")
HBD <- ggplot(HandballData, aes(x= Quarter, y = Location)) +
geom_jitter(aes(colour = Action), size = 2) +
theme_bw() +
theme(legend.title = element_blank(),
axis.title.y=element_blank()) +
scale_colour_viridis_d()
ggplotly(HBD)
KICKING DATA
# Kicking Data
KickingData <- MatchData %>%
filter(Action == "Kick Backwards" | Action == "Kick Clanger" | Action == "Kick Ineffective" | Action == "Kick Inside 50" | Action == "Kick Short" | Action == "Kick Long")
KickData <- ggplot(KickingData, aes(x= Quarter, y = Location)) +
geom_jitter(aes(colour = Action), size = 2) +
theme_bw() +
theme(legend.title = element_blank(),
axis.title.y=element_blank()) +
scale_colour_viridis_d()
ggplotly(KickData)